Configure PostgreSQL
Configure PostgreSQL
PostgreSQL is an open source relational database. This guide covers both a local install and a cloud hosted option using Supabase free tier.
Local Install
Install PostgreSQL
- Download PostgreSQL from https://www.postgresql.org/download/
- Run the installer for your operating system:
Windows:
- Run the interactive installer
- Leave the default port as
5432 - Set a password for the
postgressuperuser — note this down, you will need it shortly - When prompted about Stack Builder at the end, uncheck it and click
Finish
macOS:
- Open a terminal and run:
brew install postgresql@16
- Start the service:
brew services start postgresql@16
Connect via DBeaver
- Install DBeaver Community from https://dbeaver.io/download/
- Open DBeaver and click the
New Database Connectionbutton in the top left (the plug icon with a+) - Search for
PostgreSQL, select it, and clickNext - Fill in the connection fields:
Host:localhostPort:5432Database:postgresUsername:postgresPassword: the password you set during install
- Click
Test Connection— if this is your first PostgreSQL connection, DBeaver will prompt you to download the PostgreSQL JDBC driver. ClickDownload - Once the test passes, click
Finish - The new connection will appear in the
Database Navigatoron the left
Cloud Hosted (Supabase Free Tier)
- Go to https://supabase.com and sign up for a free account
- Create a new project, give it a name (e.g.
SQL101), set a strong database password, and choose the nearest region - Wait for the project to provision — this takes roughly 2 minutes
- In the Supabase dashboard go to
Project Settings→Database - Find the
Connection stringsection and copy theURIvalue, or use the individual fields:Host: shown underHostPort:5432Database:postgresUsername:postgresPassword: the password you set when creating the project
- Open DBeaver and create a new
PostgreSQLconnection using these details - Click
Test Connection, thenFinish
Creating the Database Schema
Now that the connection is established you can create the database schema found here. Run the script against your postgres database or a new database you have created for the course.
Notes
- If
Test Connectionfails on a local install, check the PostgreSQL service is running:- Windows: open the
Servicesapp and look forpostgresql-x64-16— start it if it is stopped - macOS: run
brew services listand confirmpostgresql@16shows asstarted
- Windows: open the
- If using Supabase, ensure your IP is not blocked — the free tier allows all IPs by default so this is rarely an issue
- Password errors: double check there are no trailing spaces copied into the
Passwordfield in DBeaver - Port conflicts: if
5432is already in use, the PostgreSQL installer lets you set an alternative port — update DBeaver to match